//全局配置文件
const express=require("express")

const app=express()
const denglu=require("./routes/index.js")
const author=require("./routes/author.js")
const article=require("./routes/article.js")
const findbyid=require("./routes/findbyid.js")
const findbyclassify=require("./routes/findbyclassify.js")
const deletebyid=require("./routes/delete.js")
const finndbyauthorid=require("./routes/findbyauthorid.js")
const updatearticle=require("./routes/update.js")
const addAriticle=require("./routes/add.js")
//中间件，可以快速接收post传递的参数，post传递的参数会添加在body属性中
app.use(express.urlencoded({extended:false}))
app.use("/api",denglu)
app.use("/api",article)
app.use("/api",author)
app.use("/api",findbyid)
app.use("/api",findbyclassify)
app.use("/api",deletebyid)
app.use("/api",updatearticle)
app.use("/api",finndbyauthorid)
app.use("/api",addAriticle)

app.listen(8080,()=>{
    console.log("8080端口已启动")
})